#
#        Python GUI - Labels - Swing
#

from GLabels import Label as GLabel
import javax.swing as swing
from Controls import to_html,from_html

class Label(GLabel):
    
    def __init__(self, text="New Label", **kwds):

        self._just=kwds.get("just","left")
        
        self._text=text
        self._j_obj=swing.JLabel(to_html(text,self._just))
        self._j_obj.show()
        
        GLabel.__init__(self,**kwds)
    
    def get_text(self):
        return from_html(self._j_obj.getText())
    
    def set_text(self,text):
        self._text=text
        self._j_obj.setText(to_html(self._text,self._just))
    
    def get_just(self):
        return self._just
    
    def set_just(self,just):
        self._just=just
        self._j_obj.setText(to_html(self._text,self._just))

